<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateShopOrderDetailTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shop_order_detail', function (Blueprint $table) {
            $table->increments('id');
            $table->integer("user_id")->default(0)->comment("用户ID");
            $table->integer("shop_order_id")->default(0)->comment("商城订单id");
            $table->integer("goods_id")->default(0)->comment("商品ID");
            $table->string("goods_name",120)->default('')->comment("商品名称");
            $table->string("goods_sn",50)->default('')->comment("商品唯一货号");
            $table->string("thumb",150)->default('')->comment("商品缩略图");
            $table->integer("market_price")->default(0)->comment("市场价（分）");
            $table->integer("cost_price")->default(0)->comment("进货价（分）");
            $table->string("attr_sn",20)->default('')->comment("规格型号");
            $table->integer("attr_name")->default('')->comment("规格名称");
            $table->integer("goods_price")->default(0)->comment("商品单价（分）");
            $table->smallInteger("num")->default(0)->comment("商品数量");
            $table->tinyInteger("goods_status")->default(0)->comment("商品状态 1未发货 2 已发货 3确认收货 4 退款");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_order_detail');
    }
}
